package org.zfes.snowier.cloud.zbss.cms.router.service.words;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.words.model.CmsWordsHistory;
import org.zfes.snowier.cloud.zbss.cms.words.service.ICmsWordsHistoryService;
@Controller 
@RequestMapping("/cms/words/cmsWordsHistory")
public class CmsWordsHistoryController extends BaseController {

	
	@Autowired
	private ICmsWordsHistoryService cmsWordsHistoryService;
	
	@RequiresPermissions(value="cmsWordsHistory:loadCmsWordsHistoryDataSet",desc="搜索历史列表")
    @RequestMapping(value="/loadCmsWordsHistoryDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsWordsHistoryDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsWordsHistoryService.loadCmsWordsHistoryDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsWordsHistory:createCmsWordsHistory",desc="搜索历史添加")
    @RequestMapping(value="/createCmsWordsHistory", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsWordsHistory(CmsWordsHistory cmsWordsHistory){
		cmsWordsHistoryService.createCmsWordsHistory(cmsWordsHistory);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsWordsHistory:loadCmsWordsHistory",desc="搜索历史加载")
    @RequestMapping(value="/loadCmsWordsHistory", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsWordsHistory(Long id){
		Optional<CmsWordsHistory> ops = cmsWordsHistoryService.loadCmsWordsHistoryById(id);
		return ajaxQuery("cmsWordsHistory",ops);
    }
	
	@RequiresPermissions(value="cmsWordsHistory:updateCmsWordsHistory",desc="搜索历史更新")
    @RequestMapping(value="/updateCmsWordsHistory", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsWordsHistory(CmsWordsHistory cmsWordsHistory){
		cmsWordsHistoryService.updateCmsWordsHistory(cmsWordsHistory);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsWordsHistory:deletCmsWordsHistory",desc="搜索历史删除")
    @RequestMapping(value="/deleteCmsWordsHistory", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsWordsHistory(Long id){
		cmsWordsHistoryService.deleteCmsWordsHistory(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}